﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FlexControls
{
    public partial class FlexTextBox : UserControl
    {
        public new event EventHandler DoubleClick;
        protected virtual void OnDoubleClick()
        {
            if (this.DoubleClick != null)
            {
                this.DoubleClick(this, EventArgs.Empty);

            }
        }
        public FlexTextBox()
        {
            InitializeComponent();
        }
        private string strText="";
        public string fcText
        {
            get
            {
                return strText;
            }
            set
            {
                strText = value;
                txt.Text = strText;
            }
        }
        public bool booValidate = true;
        public bool fcValidate
        {
            get
            {
                return booValidate;
            }
            set
            {
                booValidate = value;
            }
        }

        private void FlexTextBox_Resize(object sender, EventArgs e)
        {
            this.Height = 22;
            txt.Width = this.Width - 2;
        }

        private void txt_TextChanged(object sender, EventArgs e)
        {
            fcText = txt.Text;
        }
        public string strGenCode = "";
        public string fcGenerateCode
        {
            get
            {
                return strGenCode;
            }
            set
            {
                strGenCode = value;
            }
        }
        public string strCode = "";
        public bool booLinkTalbe = false;
        public bool fcLinkTable
        {
            get
            {
                return booLinkTalbe;
            }
            set
            {
                booLinkTalbe = value;
                if (booLinkTalbe == true)
                {
                    txt.BackColor = Color.Yellow;
                    txt.ReadOnly = true;
                }
                else
                {
                    txt.BackColor = Color.White;
                    txt.ReadOnly = false;
                }
            }
        }
        public int FormID;
        private void txt_DoubleClick(object sender, EventArgs e)
        {
            OnDoubleClick();
            
        }
    }
}
